using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace Terra.Core.Common.Models.Common;

/// <summary>
/// 批量删除DTO
/// </summary>
/// <typeparam name="TKey">实体主键类型</typeparam>
public class BatchDeleteDto<TKey>
{
    /// <summary>
    /// 主键集合
    /// </summary>
    [Required(ErrorMessage = "主键集合不能为空")]
    public List<TKey> Ids { get; set; }
}

/// <summary>
/// 批量启用/禁用DTO
/// </summary>
/// <typeparam name="TKey">实体主键类型</typeparam>
public class BatchStatusChangeDto<TKey>
{
    /// <summary>
    /// 主键集合
    /// </summary>
    [Required(ErrorMessage = "主键集合不能为空")]
    public List<TKey> Ids { get; set; }

    /// <summary>
    /// 状态值，通常 1-启用，0-禁用
    /// </summary>
    [Required(ErrorMessage = "状态值不能为空")]
    public int Status { get; set; }
}

/// <summary>
/// 批量排序DTO
/// </summary>
/// <typeparam name="TKey">实体主键类型</typeparam>
public class BatchSortDto<TKey>
{
    /// <summary>
    /// 排序项集合
    /// </summary>
    [Required(ErrorMessage = "排序项集合不能为空")]
    public List<SortItem<TKey>> Items { get; set; }
}

/// <summary>
/// 排序项
/// </summary>
/// <typeparam name="TKey">实体主键类型</typeparam>
public class SortItem<TKey>
{
    /// <summary>
    /// 主键
    /// </summary>
    public TKey Id { get; set; }

    /// <summary>
    /// 排序号
    /// </summary>
    public int Sort { get; set; }
}

/// <summary>
/// 批量分配DTO（如角色分配用户、菜单分配权限等）
/// </summary>
/// <typeparam name="TKey">实体主键类型</typeparam>
public class BatchAssignDto<TKey>
{
    /// <summary>
    /// 主实体ID
    /// </summary>
    [Required(ErrorMessage = "主实体ID不能为空")]
    public TKey MasterId { get; set; }

    /// <summary>
    /// 关联实体ID集合
    /// </summary>
    [Required(ErrorMessage = "关联实体ID集合不能为空")]
    public List<TKey> Ids { get; set; }
}

/// <summary>
/// 批量移动DTO（如将多个节点移动到某个父节点下）
/// </summary>
/// <typeparam name="TKey">实体主键类型</typeparam>
public class BatchMoveDto<TKey>
{
    /// <summary>
    /// 要移动的节点ID集合
    /// </summary>
    [Required(ErrorMessage = "节点ID集合不能为空")]
    public List<TKey> Ids { get; set; }

    /// <summary>
    /// 目标父节点ID
    /// </summary>
    public TKey ParentId { get; set; }
}